<template>
	<view class="container">
		<view class="no-collect" v-if="collectList==undefined||collectList.length<=0">
		    <view class="c">
		      <!-- <image src="../../../static/images/noCart.png" /> -->
		      <text>{{ i18n.collect.nocollect}}</text>
		    </view>
		  </view>
		
		<view class="collect-list">
			<view class="item" hover-class="uni-list-cell-hover" v-for="(item,index) in collectList" :key="index" @tap="openinfo" :data-id="item.valueId">
				<view class="uni-media-list">
					<image class="img" :src="item.picUrl"></image>
					<view class="info">
						<view class="name">{{item.name}}</view>
						<view class="price">￥{{item.retailPrice}}</view>
					</view>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				collectList:[],
				//show:true,
			};
		},
		onLoad:function(){
			let title=this.$i18nMsg().pages.collect;
			uni.setNavigationBarTitle({
				title
			});
			uni.showLoading({
				title:"加载中...."
			})
			let userInfo = uni.getStorageSync('userInfo') || '';
			uni.request({
				url: this.apiRoot+'collect/list',
				method: 'GET',
				header: {
				        'Content-Type': 'application/json',
				        'X-Litemall-Token':userInfo.token
				      },
				data: {type:0,page:1,limit:10},
				success: res => {
					//debugger
					this.collectList = res.data.data.list;
					
					uni.hideLoading();
				},
				fail: () => {},
				complete: () => {}
			});
		},
		computed:{
			   i18n() {  
			     return this.$i18nMsg()  
			   }
			},

		methods: {
			openinfo(e) {
				var id = e.currentTarget.dataset.id;
				uni.navigateTo({
					url: '../product/product?id='+id
				});
				
			}
		},
	}
</script>

<style>
.container {
  background: #f4f4f4;
  min-height: 100%;
  width: 100%;
  height: auto;
  overflow: hidden;
}

.no-collect {
  width: 100%;
  height: auto;
  margin: 0 auto;
}

.no-collect .c {
  width: 100%;
  height: auto;
  margin-top: 200rpx;
}

.no-collect .c image {
  margin: 0 auto;
  display: block;
  text-align: center;
  width: 258rpx;
  height: 258rpx;
}

.no-collect .c text {
  margin: 0 auto;
  display: block;
  width: 258rpx;
  height: 29rpx;
  line-height: 29rpx;
  text-align: center;
  font-size: 29rpx;
  color: #999;
}

.collect-list {
  width: 100%;
  height: auto;
  overflow: hidden;
  background: #fff;
  padding-left: 30rpx;
  border-top: 1px solid #e1e1e1;
}

.item {
  height: 212rpx;
  width: 720rpx;
  background: #fff;
  padding: 30rpx 30rpx 30rpx 0;
  border-bottom: 1px solid #e1e1e1;
}

.item:last-child {
  border-bottom: 1px solid #fff;
}

.item .img {
  float: left;
  width: 150rpx;
  height: 150rpx;
}

.item .info {
  float: right;
  width: 540rpx;
  height: 150rpx;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding-left: 20rpx;
}

.item .info .name {
  font-size: 28rpx;
  color: #333;
  line-height: 40rpx;
}

.item .info .subtitle {
  margin-top: 8rpx;
  font-size: 24rpx;
  color: #888;
  line-height: 40rpx;
}

.item .info .price {
  margin-top: 8rpx;
  font-size: 28rpx;
  color: #333;
  line-height: 40rpx;
}
</style>

